package com.cy.pj.brand.service.impl;

import com.cy.pj.brand.dao.BrandDao;
import com.cy.pj.brand.pojo.Brand;
import com.cy.pj.brand.service.BrandService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class BrandServiceImpl implements BrandService {
    private static Logger log= LoggerFactory.getLogger(BrandServiceImpl.class);
    @Autowired
   private BrandDao brandDao;
    @Override
    public List<Brand> findBrand(String name) {
        long t1=System.currentTimeMillis();
        List<Brand> list= brandDao.findBrand(name);
        long t2=System.currentTimeMillis();
        log.info("findBrand->time->{}",(t2-t1));
        return list;

    }

    @Override
    public Integer deleteById(Integer id) {
        int rows= brandDao.deleteById(id);
        return rows;
    }

    @Override
    public Integer addBrand(Brand brand) {
        return brandDao.addBrand(brand);
    }

    @Override
    public Brand findById(Integer id) {
        return brandDao.findById(id);
    }

    @Override
    public Integer updateBrand(Brand id) {
        return brandDao.updateBrand(id);
    }
}
